<?php namespace Common\Model;
use Hdphp\Model\Model;
class OrderListnow extends Model{
    protected $table='orderlist';
    public function store(){
        $ordernowModel=new Orderdnow();
        $ordernum=$_SESSION['ordernumnow'];
        $oid=$ordernowModel->where("ordernum='{$ordernum}'")->pluck('oid');
        $orderpri=Q('post.orderpri');
//        foreach($_SESSION['buynow'] as $u){
            $commodlistModel=new Commodlist();
            $colid=$commodlistModel->where("cogroupid='{$_SESSION['buynow']['colizuheid']}'")->pluck('colid');
            $data=array(
                'olinum'=>$_SESSION['buynow']['num'],
                'olipri'=>$orderpri,
                'shop_orderd_oid'=>$oid,
                'shop_commodity_coid'=>$_SESSION['buynow']['id'],
                'shop_commodlist_colid'=>$colid
            );
            $this->add($data);
//        }
        return true;
    }
}